package offer.secnod;

public class Offer11 {

    int findMin(int[] nums){
        int left=0;
        int length = nums.length;
        int right=length-1;

        while (left<=right ){
            int mid=left+(right-left)/2;
            if (nums[mid]<nums[right]){
                right=mid;
            }else if (nums[mid]>nums[right]){
                left=mid+1;
            }else  if (nums[mid]==nums[right]){
                right--;
            }
        }

        return  nums[left];
    }

    public static void main(String[] args) {
        Offer11 offer11 = new Offer11();
        int[] arr={2,2,2,0,1};
        System.out.println(offer11.findMin(arr));
    }

}
